﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using com.pro2e.console.core.valueobject;
using NHibernate;
using com.pro2e.console.service.system.vo;

using System.Collections.Generic;
using NHibernate.Criterion;


/// <summary>
/// ItemParamDao 的摘要描述
/// </summary>
/// 

namespace com.pro2e.console.service.system.dao
{
    public class ItemParamDao : DaoImp
    {
        public ItemParamDao()
        {
           
        }

        public IList<ItemParamVO> GetAllVOByNoDel()
        {

            ICriteria criteria = GetHBNSession().CreateCriteria(typeof(ItemParamVO));
            criteria.Add(Expression.Eq("Deleted", false));

            IList<ItemParamVO> result = criteria.List<ItemParamVO>();

            if (result != null && result.Count > 0)
            {
                return result;
            }
            else
            {
                return null;
            }

        }

        /// <summary>
        /// 取得不含刪除註記與分類的所有VO
        /// </summary>
        /// <param name="classify">分類名</param>
        /// <returns></returns>
        internal IList<ItemParamVO> GetAllItemParamVOByNoDel(string classify)
        {
            ICriteria criteria = GetHBNSession().CreateCriteria(typeof(ItemParamVO));
            criteria.Add(Expression.Eq("Deleted", false));
            criteria.Add(Expression.Eq("Classify", classify));

            IList<ItemParamVO> result = criteria.List<ItemParamVO>();

            if (result != null && result.Count > 0)
            {
                return result;
            }
            else
            {
                return null;
            }
        }
    }
}